package com.franklin.java.api.ui.jpanel.combobox;

import com.franklin.plugins.common.collection.PrettyHashSet;

import javax.swing.*;
import java.util.Set;

/**
 * @author Franklin
 * @since 2021/9/26 14:19
 */
public class MyComboBox<E> extends JComboBox<E> {

    private Set<E> itemSet = new PrettyHashSet<>();

    @Override
    public void addItem(E item) {
        if (!itemSet.contains(item)) {
            itemSet.add(item);
            super.addItem(item);
        }
    }
}
